FROM node:24 AS builder
WORKDIR /home/codes
RUN npm config set registry https://registry.npmmirror.com
ENV NODE_OPTIONS=--openssl-legacy-provider
COPY ./ .
RUN npm install
RUN npm run build:prod
 
FROM nginx:1.28.0
WORKDIR /home/www
COPY --from=builder /home/codes/dist ./dist
COPY ./ruoyi.conf /etc/nginx/conf.d/default.conf
CMD ["nginx","-g","daemon off;"]